package io.e2x.testground.fruitstore.dal.entities;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Transient;
import org.springframework.data.annotation.Version;
import org.springframework.data.relational.core.mapping.Table;

import java.math.BigDecimal;

/**
 * 店铺商品
 * @author: sukimiya
 * @date: 2020/5/27 16:02
 */
@Table("STORE_SPU")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class StoreSpu {
    @Id
    private long id;
    /**
     * 店铺ID
     */
    private long storeId;

    private long skuId;

    public StoreSpu setSkuId(long skuId) {
        this.skuId = skuId;
        return this;
    }
    /**
     * 商品编号
     */
    private String spuNo;

    /**
     * 是否打折
     */
    private Boolean isDiscount;

    /**
     * 折扣
     */
    private BigDecimal discount;

    @Transient
    private Integer count = 0;

    public StoreSpu(long id, String no, boolean b, BigDecimal i, int i1) {
        this.storeId = id;
        this.spuNo = no;
        this.isDiscount = b;
        this.discount = i;
        this.count = i1;
        this.skuId = 0;
    }
}
